<template>
	<view>
		<view class="article-wrap">
			<view v-for="(item,index) in homeDatas" :key="index">
				<view class="article-wrap-heard">
					<view class="article-wrap-avalter">
						<image :src="item.userinfoData[0].avatarUrl" mode=""></image>
						<text>{{item.userinfoData[0].nickName}}</text>
					</view>
				</view>
				<view class="article-wrap-text" @click="preimageg(item._id)">
					<text>{{item.textarea}}</text>
					<view class="article-wrap-text-img">
						<block v-for="(items,index) in item.uploadImg" :key="index">
							<image :src="items" mode="aspectFill"></image>
						</block>
					</view>
				</view>
				<view class="article-wrap-time">
					<text>发表时间：{{item.time}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	//引入预览图片模块
	import packmages from '../../../components/images.js'
	
	//搜所仓库的内容
	import {mapState} from 'vuex'
	
	export default {
		data() {
			return {
				homeDatas:[],
				
			}
		},
		methods: {
			//预览图片
			preimage(index,imagespack){
				// console.log(imagespack)
				packmages(index,imagespack).then(res=>{
					console.log(res)
				}).catch(err=>{
					console.log(err)
				})
			},
			preimageg(ids){
				console.log(ids)
				wx.navigateTo({
					url: '../details/details?id=' + ids
				})
			}
			
		},
		computed:{
			...mapState(['search']),
			count(){
				console.log(this.search.searching)
				this.homeDatas = this.search.searching
			}
		},
	}
</script>

<style lang="scss">
	.article-wrap {
		width: 100%;
		height: auto;
		display: flex;
		flex-direction: column;
		background-color: #ffffff;
		padding: 20upx;
		box-sizing: border-box;
		margin-bottom: 20upx;

		.article-wrap-heard {
			display: flex;
			justify-content: space-between;
			align-items: center;

			.article-wrap-avalter {
				display: flex;
				justify-content: start;
				align-items: center;
				padding: 10upx 20upx 20upx 1upx;

				image {
					width: 70upx;
					height: 70upx;
					border-radius: 50%;
					margin-right: 20upx;
				}

				text {
					color: #505050;
					font-size: 35upx;
					font-weight: bold;
				}
			}

			.article-wrap-guanzhu {
				padding: 10upx 30upx;
				background-color: #5500ff;
				border-radius: 40upx;
				color: #ffffff;
				box-shadow: 0upx 0upx 20upx rgba(0, 170, 255, 0.4);
			}

		}

		.article-wrap-bottom {
			display: flex;
			justify-content: space-around;
			align-items: center;
			border-top: #f0f0f0 1px solid;
			padding: 15upx;

			.article-wrap-dianzan {
				display: flex;
				justify-content: space-around;
				align-items: center;

				image {
					width: 40upx;
					height: 40upx;
					margin-right: 10upx;
				}

				text {
					color: #7e7e7e;
				}
			}
		}

		.article-wrap-text {
			padding: 2upx 15upx;

			text {
				font-family: "微软雅黑";
				font-size: 34upx;
				color: #161616;
			}

			.article-wrap-text-img {
				display: flex;
				justify-content: start;
				flex-wrap: wrap;

				image {
					width: 338upx;
					height: 338upx;
					padding: 20upx 25upx 5upx 0;
					box-sizing: border-box;
				}
			}
		}

		.article-wrap-time {
			margin: 20upx;

			text {
				font-size: 28upx;
				color: #666666;
			}
		}
	}
</style>
